package com.grandtech.insurance.common.utils.collect;

import java.io.Serializable;

/**
 * Created by zy on 2018/9/27.
 */

public class Criteria implements Serializable{

    protected String fieldName;

    protected String linkName;

    protected Object fieldValue;

    public Criteria() {
    }

    public Criteria(String fieldName) {
        this.fieldName = fieldName;
    }

    public String getFieldName() {
        return fieldName;
    }

    public void setFieldName(String fieldName) {
        this.fieldName = fieldName;
    }

    public String getLinkName() {
        if (linkName == null) new Throwable("linkName must not null!");
        return linkName.trim();
    }

    public String getLinkNameByJava() {
        if (linkName == null) new Throwable("linkName must not null!");
        if (linkName.trim().contains("=")) {

        }
        if (linkName.trim().contains("like")) {

        }
        if (linkName.trim().contains("<>")) {

        }
        if (linkName.trim().contains("order by")) {

        }
        return linkName;
    }

    public void setLinkName(String linkName) {
        this.linkName = linkName;
    }

    public Object getFieldValue() {
        return fieldValue.toString();
    }

    public void setFieldValue(Object fieldValue) {
        this.fieldValue = fieldValue;
    }
}
